package game;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;

/**
 * @Author: liwan
 * @Description: 图片工具类
 * @Date: create in 2021/8/31 15:24:42
 */
public class ImageUtil {
    /**
    * @Author: liwan
    * @Description: 给一个路径返回一个对象
    * @Params: path 图片路径
    * @Return: {@link BufferedImage} 图片对象
    * @DateTime: 2021/8/31 15:28:07
    */
    public static BufferedImage getImg(String path) {
        BufferedImage image = null;
        try {
            image = ImageIO.read(ImageUtil.class.getResource(path));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return image;
    }
}
